import 'dart:ffi';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:shop/shop/rider/Center.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shop/config/config.dart';
import 'package:shop/http/HttpUtil.dart';
import 'package:shop/route/my_route.dart';

/**
 * 订单详情
 */
class OrderDetail extends StatefulWidget {
  OrderDetail({Key key,}) : super(key: key);

  @override
  _OrderDetail createState() => _OrderDetail();
}

class _OrderDetail extends State<OrderDetail> {


// 显示订单中的商品
//   Container _showGoods(item){
//     // print(item['num']);
//     return Container(
//       height: 80,
//       child:Row(
//         mainAxisAlignment: MainAxisAlignment.spaceAround,
//         crossAxisAlignment: CrossAxisAlignment.center,
//         children: [
//           Checkbox(value: item['isSelect'], onChanged: (val){// 点击勾选
//             item['isSelect']=val;
//             setState(() {
//
//             });
//           }),
//           Image.asset("assets/phone2.jpg",width: 200,),
//           Expanded(
//             child: Column(
//               children: [
//                 Text(item['gname']),
//                 Text("红色;8+256GB"),
//                 Text("￥${item['gprice']}"),
//                 Container(
//                   child: Row(
//                     children: [
//                       GestureDetector(onTap: (){
//                         if(item['num']>1)
//                           item['num']--;
//                         setState(() {
//
//                         });
//                       },
//                           child:Container(
//                             width: 30,
//                             height: 20,
//                             decoration: BoxDecoration(
//                                 border: Border.all(
//                                   color: Colors.black12,
//                                   width: 1.0,
//                                 ),
//                                 borderRadius: BorderRadius.circular(3.0)
//                             ),
//                             child:Center(child: Text("-"),) ,
//                           )
//                       ),
//                       Text("${item['num']}"),
//                       GestureDetector(onTap: (){
//                         item['num']++;
//                         setState(() {
//
//                         });
//                       },
//                       child:Container(
//                         width: 30,
//                         height: 20,
//                         decoration: BoxDecoration(
//                             border: Border.all(
//                               color: Colors.black12,
//                               width: 1.0,
//                             ),
//                             borderRadius: BorderRadius.circular(3.0)
//                         ),
//                         child:Center(child:  Text("+"),),
//                       )),
//                     ],
//                   ),
//                 )// Positioned(child: Text("*1"),right: 10,),
//               ],
//             )
//           )
//         ],
//       ) ,
//     );
//   }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("订单详情"),
        centerTitle: true,
      ),
      body: Column(
        children: <Widget>[
          new Expanded(
              child: Container(
                padding:EdgeInsets.all(10),
                child: ListView(
                  children: [
                    Container(
                      decoration: BoxDecoration(color: Colors.white,borderRadius: BorderRadius.circular(10)),
                      padding: EdgeInsets.all(10),
                      margin: EdgeInsets.only(top: 10),
                      child: Column(
                        children: [
                          Row(children: [
                            Icon(Icons.card_giftcard),
                            Text("官方旗舰店")
                          ]),
                          Container(
                            color: Colors.white,
                            child: Column(
                              children: [
                                Row(
                                  children: [
                                    Image.asset("assets/6.png",width: 50,),
                                    Text("一个大美女")
                                  ],
                                ),
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    Text("规格"),
                                    Text("*2")
                                  ],
                                )
                              ],
                            ),
                          ),
                          Container(
                            color: Colors.white,
                            child: Column(
                              children: [
                                Row(
                                  children: [
                                    Image.asset("assets/6.png",width: 50,),
                                    Text("2个大美女")
                                  ],
                                ),
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    Text("规格"),
                                    Text("*2")
                                  ],
                                )
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                    // 配送至
                    SizedBox(height: 20,),
                    Container(
                      decoration: BoxDecoration(color: Colors.white,borderRadius: BorderRadius.circular(10)),
                      padding: EdgeInsets.all(10),
                      margin: EdgeInsets.only(top: 10),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text("配送至"),
                          SizedBox(height: 20,),
                          Text("幸福大厦909"),
                          Text("株洲天元区黄河北路"),
                          Divider(),
                          Row(children: [Text("张三"),SizedBox(width: 10,),
                            Text("18974743423"),],),
                          Text("备注："),
                          Text("下单时间：2020-11-15")
                        ],
                      ),
                    )
                  ],
                ),
              ),
          ),
          Row(
            children: <Widget>[
              Container(
                width: 380,
                decoration: BoxDecoration(color: Colors.amber,borderRadius: BorderRadius.circular(10)),
                padding: EdgeInsets.all(10),
                child: Text("开始配送"),
              )
            ],
          )
        ]
      ),
    );
  }



}